home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 4 / FM Towns Free Software Collection 4 - Disc 1.iso / t_os / wink / source / edit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-19  |  27.6 KB  |  1,240 lines

  1. #include    <stdio.h>
  2. #include    <stdlib.h>
  3. #include    <ctype.h>
  4. #include    "defs.h"
  5. #include    "key.h"
  6.  
  7. extern int  strlen();
  8. extern void memset();
  9.  
  10. extern int  Get_key();
  11. extern int  getch();
  12. extern int  kbhit();
  13. extern void KYB_clic();
  14.  
  15. extern void Set_vram();
  16. extern void wrtstr();
  17. extern void Dsp_vram();
  18. extern void Dsp_vram_flash();
  19. extern void Dsp_wrt_flg();
  20. extern void Set_file_name();
  21. extern void ChgCol_wind();
  22.  
  23. extern int  save();
  24. extern int  File_sel();
  25. extern BOOL iskan();
  26.  
  27. extern void Cut_buf();
  28. extern void Ins_buf();
  29. extern void Del_buf();
  30. extern void Buf_init();
  31. extern int  New_wind();
  32. extern int  Del_wind();
  33. extern void ReSize_wind();
  34. extern LONG Line_ptr();
  35. extern LONG Undo_get();
  36. extern void Undo_put();
  37.  
  38. extern LONG Bak_line2();
  39. extern LONG Nxt_line2();
  40. extern LONG USerch();
  41.  
  42. extern void ASCII_code();
  43. extern void KANJI_code();
  44. extern void Printer_out();
  45.  
  46. extern char     *file_name;
  47. extern UCHAR    vram[];
  48. extern short    ReWrt_flg;
  49. extern short    dlp_flg,Wind_flg;
  50.  
  51.        int      Line_no=0;
  52.        short    Line_X=0,Line_Y=0;
  53.        int      Wrt_mode=FALSE,TAB_mode=0;
  54.        char     *SPCSTR="                                     ";
  55.        char     *FILEMEI="ファイル名 ";
  56. static int    Ins_flg=FALSE;
  57. static int    Endof_edit=FALSE;
  58. static UCHAR     sctmp[160]={ 0 };
  59. static UCHAR    rpsctmp[160]={ 0 };
  60. static UCHAR    rpdstmp[160]={ 0 };
  61.  
  62. LONG    Top_line(ptr)
  63. LONG    ptr;
  64. {
  65.     return Bak_line(Nxt_line(ptr));
  66. }
  67. char    *Dmy_form(p,i,ch1,ch2,ch3)
  68. char    *p;
  69. int    i,ch1,ch2,ch3;
  70. {
  71.     *(p++) = ch1; *(p++) = 0x1B;
  72.     while ( i-- > 0 ) {
  73.     *(p++) = ch2; *(p++) = 0x1B;
  74.     }
  75.     *(p++) = ch3; *(p++) = 0x1B; *p = '\0';
  76.     return p;
  77. }
  78. int    Yes_no(ttl)
  79. char    *ttl;
  80. {
  81.     int     len,x,ch,ec;
  82.     char    tmp[160];
  83.  
  84.     len = strlen(ttl) + 4; x = 36 - len / 2;
  85.     Dmy_form(tmp,len,0x98,0x95,0x99); 
  86.     wrtstr(tmp,x,8,0x02);
  87.  
  88.     Dmy_form(tmp,len,0x96,0x20,0x96); 
  89.     wrtstr(tmp,x,9,0x02);
  90.     wrtstr(tmp,x,10,0x02);
  91.     wrtstr(ttl,x+2,10,0x02);
  92.  
  93.     wrtstr(tmp,x,11,0x02);
  94.     wrtstr(tmp,x,12,0x02);
  95.     wrtstr("はい/Y  いいえ/N",28,12,0x02);
  96.  
  97.     wrtstr(tmp,x,13,0x02);
  98.     Dmy_form(tmp,len,0x9A,0x95,0x9B); 
  99.     wrtstr(tmp,x,14,0x02);
  100.  
  101.     ch = Get_key(&ec);
  102. #ifdef    TOWNS
  103.     Dsp_vram_flash();
  104. #endif
  105.     if ( ch == 'y' || ch == 'Y' || ec == 0x7300 )
  106.     return TRUE;
  107.     else
  108.     return FALSE;
  109. }
  110. int    Sel_menu(menu,x,y,old_no)
  111. char    *menu[];
  112. int    x,y,*old_no;
  113. {
  114.     int     i,mx,ch,ec,no,fg;
  115.     char    tmp[80];
  116.     int     nul_no[8],nul=0;
  117.  
  118.     i = strlen(menu[0]);
  119.     Dmy_form(tmp,i,0x98,0x95,0x99); 
  120.     wrtstr(tmp,x,y++,0x07);
  121.     no = *old_no;
  122.     for ( mx = 0 ; menu[mx] != NULL ; mx++ ) {
  123.     if ( menu[mx][0] == '\0' ) {
  124.         Dmy_form(tmp,i,0x93,0x95,0x92); 
  125.         nul_no[nul++] = mx;
  126.         if ( no >= mx ) no++;
  127.     } else
  128.         sprintf(tmp,"\x96\x1B%s\x96\x1B",menu[mx]);
  129.     wrtstr(tmp,x,y+mx,0x07);
  130.     }
  131.     Dmy_form(tmp,i,0x9A,0x95,0x9B); 
  132.     wrtstr(tmp,x,y+mx,0x07);
  133.  
  134.     for ( ; ; ) {
  135.     if ( no >= 0 )
  136.         wrtstr(menu[no],x+1,y+no,0x14);
  137.     ch = Get_key(&ec);
  138.     if ( no >= 0 )
  139.         wrtstr(menu[no],x+1,y+no,0x07);
  140.     if ( ch == ' ' || ch == '\x1F' || ec == 0x7200 ) {
  141.         if ( ++no >= mx )
  142.         no = ERR;
  143.         else if ( menu[no][0] == '\0' && ++no >= mx )
  144.         no = ERR;
  145.     } else if ( ch == '\x08' || ch == '\x1E' ) {
  146.         if ( --no < ERR )
  147.         no = mx - 1;
  148.         else if ( no >= 0 && menu[no][0] == '\0' && --no < ERR )
  149.         no = mx - 1;
  150.     } else if ( ch == '\x0D' || ec == 0x7300 ) {
  151.         fg = 0;
  152.         break;
  153.     } else if ( ec == 0x7200 || ec == 0x0100 || 
  154.                        (ec >= 0x5D00 && ec <= 0x6600) ) {
  155.         fg = 1;
  156.         break;
  157.     } else if ( ch >= '1' && ch <= '9' && (ch - '1') < mx ) {
  158.         no = ch - '1';
  159.         fg = 2;
  160.         break;
  161.     }
  162.     }
  163.     if ( fg != 2 ) {
  164.     if ( no >= 0 )
  165.         wrtstr(menu[no],x+1,y+no,0x14);
  166.     for ( i = 0,mx = no ; i < nul ; i++ ) {
  167.         if ( no >= nul_no[i] )
  168.         mx--;
  169.     }
  170.     no = mx;
  171.     }
  172. #ifdef    TOWNS
  173.     Dsp_vram_flash();
  174. #endif
  175.     *old_no = no;
  176.     if ( no == ERR || fg == 1 )
  177.     return ERR;
  178.     else
  179.     return FALSE;
  180. }
  181. UCHAR    *kanji_chk(str,len)
  182. UCHAR    *str;
  183. int    len;
  184. {
  185.     while ( len > 0 ) {
  186.     if ( iskanji(*str) && iskanji2(*(str+1)) ) {
  187.         str += 2;
  188.         len -= 2;
  189.     } else {
  190.         str++;
  191.         len--;
  192.     }
  193.     }
  194.     return str;
  195. }
  196. BOOL    Input(arg,ttl)
  197. UCHAR    *arg;
  198. char    *ttl;
  199. {
  200.     int        ch,ec,x,len;
  201.     int     Bk_X,Bk_Y;
  202.     BOOL    fg=FALSE;
  203.     char    tmp[80];
  204.  
  205.     sprintf(tmp,"%s%36s",ttl,"");
  206.     x = strlen(ttl) + 15;
  207.     Bk_X = Cur_X; Bk_Y = Cur_Y;
  208.     Cur_Y = (0 - OFF_Y);
  209.     wrtstr(tmp,15,0,0x07);
  210.     for ( len = strlen(arg) ; ; ) {
  211.     arg[len] = 0xFE; arg[len+1] = 0x1B;
  212.     memset(arg+len+2,' ',34-len);
  213.     arg[34] = '\0';
  214.     Cur_X = x + len; ReWrt_flg = ERR;
  215.     wrtstr(arg,x,0,0x07);
  216.         ch = Get_key(&ec);
  217.     if ( ch != 0xFFFF && ch >= ' ' && len < 34 )
  218.         arg[len++] = ch;
  219.     else if ( ch == '\x0D' || ec == 0x7300 )
  220.         break;
  221.     else if ( ch == '\x1B' || ec == 0x7200 ) {
  222.         fg = ERR;
  223.         break;
  224.     } else if ( ch == '\x08' && len > 0 ) {
  225.         len--;
  226.         if ( (arg + len) != kanji_chk(arg,len) )
  227.         len--;
  228.     }
  229.     }
  230.     arg[len] = '\0';
  231.     memset(tmp,' ',50);
  232.     tmp[50] = 0;
  233.     wrtstr(tmp,15,0,0x1F);
  234.     Cur_X = Bk_X; Cur_Y = Bk_Y;
  235.     return fg;
  236. }
  237. void    Line_set()
  238. {
  239.     LONG    p;
  240.  
  241.     for ( Line_no = 0, p = 0 ; p < top_ptr ; Line_no++ )
  242.         p = Nxt_line(p);
  243. }
  244. BOOL    Cut_buff(sp,ep)
  245. LONG    sp,ep;
  246. {
  247.     Undo_put(sp,ep - sp);
  248.     return FALSE;
  249. }
  250. void    ins_chr(str,len)
  251. UCHAR    *str;
  252. int    len;
  253. {
  254.     LONG    p;
  255.  
  256.     Ins_buf(ent_ptr,len,str);
  257.     ent_ptr += len; btm_ptr += len;
  258.     while ( (p = Nxt_line(lin_ptr)) <= ent_ptr ) {
  259.     if ( (lin_ptr = p) == btm_ptr )
  260.         break;
  261.     }
  262.     Wrt_flg = Wrt_mode = TRUE;
  263. }
  264. void    set_chr(str,len)
  265. UCHAR    *str;
  266. int    len;
  267. {
  268.     LONG    p;
  269.  
  270.     if ( Ins_flg == FALSE || ent_ptr == btm_ptr ) {
  271.     ins_chr(str,len);
  272.     return;
  273.     }
  274.  
  275.     p = Nxt_line(lin_ptr);
  276.     while ( len > 0 ) {
  277.     if ( ent_ptr == btm_ptr || *Cnv_ptr(ent_ptr) == '\x0D' ) {
  278.         ins_chr(str,len);
  279.         return;
  280.     } else {
  281.        while ( len > 0 ) {
  282.         if ( iskan(ent_ptr) != FALSE )
  283.             *Cnv_ptr(ent_ptr+1) = ' ';
  284.         *Cnv_ptr(ent_ptr++) = *(str++);
  285.         len--;
  286.         if ( ent_ptr == btm_ptr )
  287.             break;
  288.        }
  289.     }
  290.     if ( ent_ptr >= p ) {
  291.         lin_ptr = p;
  292.         p = Nxt_line(p);
  293.     }
  294.     }
  295.     Wrt_flg = Wrt_mode = TRUE;
  296. }
  297. LONG    Ent_pos()
  298. {
  299.     int        x;
  300.     LONG    p;
  301.  
  302.     for ( x = 0,p = lin_ptr ; x < Line_X && p < btm_ptr && 
  303.                     *Cnv_ptr(p) != '\x0D' ; ) {
  304.         if ( iskan(p) != FALSE ) {
  305.             x+=2; p+=2;
  306.     } else if ( *Cnv_ptr(p) == '\t' ) {
  307.             x = (((x + TAB) / TAB) * TAB);
  308.         p++;
  309.         } else {
  310.         x++; p++;
  311.     }
  312.     }
  313.     return p;
  314. }
  315. void    CR_put()
  316. {
  317.     if ( Ins_flg == FALSE || ent_ptr == btm_ptr ) {
  318.     ins_chr((UCHAR *)"\x0D\x0A",2);
  319.     return;
  320.     }
  321.     lin_ptr = ent_ptr = Nxt_line(lin_ptr);
  322. }
  323. void    TAB_put()
  324. {
  325.     int        i,j,x;
  326.     LONG    p;
  327.     UCHAR   tmp[40];
  328.  
  329.     if ( TAB_mode == 0 ) {
  330.     set_chr((UCHAR *)"\t",1);
  331.     return;
  332.     }
  333.  
  334.     for ( x = 0,p = lin_ptr ; p < ent_ptr ; ) {
  335.         if ( iskan(p) != FALSE ) {
  336.             x+=2; p+=2;
  337.     } else if ( *Cnv_ptr(p) == '\t' ) {
  338.             x = ((x + TAB) / TAB) * TAB;
  339.         p++;
  340.         } else {
  341.         x++; p++;
  342.     }
  343.     }
  344.     j = ((x + TAB) / TAB) * TAB - x;
  345.     for ( i = 0 ; i < j ; i++ )
  346.     tmp[i] = ' ';
  347.     set_chr(tmp,j);
  348. }
  349. void    Word_cut()
  350. {
  351.     int     i,ch;
  352.     LONG    p;
  353.     UCHAR   *s;
  354.  
  355.     for ( p = ent_ptr ; p != btm_ptr && 
  356.         ((ch = *Cnv_ptr(p)) == ' ' || ch == '\t') ; p++ );
  357.     s = sctmp; i = 0;
  358.     while ( i < 160 && 
  359.         p != btm_ptr && ((ch = *Cnv_ptr(p)) >= '0' || ch == '_') ) {
  360.     *(s++) = ch;
  361.     p++;
  362.     }
  363.     *s = '\0';
  364. }
  365. void    Word_serch()
  366. {
  367.     LONG    p;
  368.  
  369.     if ( sctmp[0] == '\0' )
  370.     return;
  371.     if ( (p = USerch(FALSE,ent_ptr,sctmp)) >= btm_ptr )
  372.     return;
  373.     if ( p == ent_ptr ) {
  374.     p += strlen(sctmp);
  375.         if ( (p = USerch(FALSE,p,sctmp)) >= btm_ptr )
  376.         return;
  377.     }
  378.     ent_ptr = p;
  379.     lin_ptr = Top_line(ent_ptr);
  380.     return;
  381. }
  382. void    Cur_up()
  383. {
  384.     int     i;
  385.  
  386.     if ( lin_ptr == 0 )
  387.     return;
  388.     if ( lin_ptr == btm_ptr && *Cnv_ptr(lin_ptr-1) != 0x0A ) {
  389.         lin_ptr = Bak_line(lin_ptr);
  390.         lin_ptr = Bak_line(lin_ptr);
  391.     } else 
  392.         lin_ptr = Bak_line2(lin_ptr);
  393.     ent_ptr = Ent_pos();
  394.     if ( lin_ptr < top_ptr ) {
  395.     for ( i = 5 ; top_ptr > 0 && i > 0 ; i-- ) {
  396.         top_ptr = Bak_line(top_ptr);
  397.         Line_no--;
  398.     }
  399.     }
  400. }
  401. void    Cur_down()
  402. {
  403.     if ( lin_ptr == btm_ptr )
  404.     return;
  405.     lin_ptr = Nxt_line2(lin_ptr);
  406.     ent_ptr = Ent_pos();
  407. }
  408. void    Scr_up()
  409. {
  410.     if ( lin_ptr == btm_ptr )
  411.     return;
  412.     top_ptr = Nxt_line(top_ptr);
  413.     lin_ptr = Nxt_line(lin_ptr);
  414.     ent_ptr = Ent_pos();
  415.     Line_no++;
  416. }
  417. void    Scr_down()
  418. {
  419.     if ( top_ptr == 0 ) {
  420.     Cur_up();
  421.         return;
  422.     }
  423.     top_ptr = Bak_line(top_ptr);
  424.     lin_ptr = Bak_line(lin_ptr);
  425.     ent_ptr = Ent_pos();
  426.     Line_no--;
  427. }
  428. void    PScr_up()
  429. {
  430.     int     i;
  431.  
  432.     for ( i=10 ; i > 0 ; i-- ) 
  433.     Scr_up();
  434. }
  435. void    PScr_down()
  436. {
  437.     int     i;
  438.  
  439.     for ( i=10 ; i > 0 ; i-- )
  440.     Scr_down();
  441. }
  442. void    Cur_rit()
  443. {
  444.     LONG    p;
  445.  
  446.     if ( ent_ptr == btm_ptr )
  447.     return;
  448.  
  449.     if ( iskan(ent_ptr) != FALSE ||
  450.     (*Cnv_ptr(ent_ptr) == '\x0D' && *Cnv_ptr(ent_ptr+1) == '\x0A') )
  451.     ent_ptr += 2;
  452.     else
  453.     ent_ptr++;
  454.     if ( (p = Nxt_line(lin_ptr)) <= ent_ptr )
  455.     lin_ptr = p;
  456. }
  457. void    Cur_left()
  458. {
  459.     LONG    p,s;
  460.  
  461.     if ( ent_ptr == 0 )
  462.     return;
  463.     if ( ent_ptr == lin_ptr ) {
  464.     if ( lin_ptr == top_ptr ) {
  465.         top_ptr = Bak_line(top_ptr);
  466.         Line_no--;
  467.     }
  468.     lin_ptr = Bak_line(lin_ptr);
  469.     }
  470.     for ( p = s = lin_ptr ; p < ent_ptr ; ) {
  471.         s = p;
  472.     if ( iskan(p) != FALSE ||
  473.         (*Cnv_ptr(p) == '\x0D' && *Cnv_ptr(p+1) == '\x0A' ) )
  474.         p+=2;
  475.     else
  476.         p++;
  477.     }
  478.     ent_ptr = s;
  479. }
  480. void    Cur_ltop()
  481. {
  482.     ent_ptr = lin_ptr;
  483. }
  484. void    Cur_lbtm()
  485. {
  486.     while ( ent_ptr != btm_ptr && *Cnv_ptr(ent_ptr) != '\x0D' )
  487.     Cur_rit();
  488. }
  489. void    Rit_word()
  490. {
  491.     while ( ent_ptr != btm_ptr && *Cnv_ptr(ent_ptr) >= '0' )
  492.     Cur_rit();
  493.     while ( ent_ptr != btm_ptr && *Cnv_ptr(ent_ptr) < '0' )
  494.     Cur_rit();
  495. }
  496. void    Left_word()
  497. {
  498.     if ( ent_ptr > 0 && *Cnv_ptr(ent_ptr) >= '0' && 
  499.              *Cnv_ptr(ent_ptr-1) >= '0' ) {
  500.         while ( ent_ptr > 0 && *Cnv_ptr(ent_ptr) >= '0' )
  501.         Cur_left();
  502.     } else {
  503.         while ( ent_ptr > 0 && *Cnv_ptr(ent_ptr) >= '0' )
  504.         Cur_left();
  505.         while ( ent_ptr > 0 && *Cnv_ptr(ent_ptr) < '0' )
  506.         Cur_left();
  507.         while ( ent_ptr > 0 && *Cnv_ptr(ent_ptr) >= '0' )
  508.         Cur_left();
  509.     }
  510.     if ( ent_ptr > 0 && *Cnv_ptr(ent_ptr) < '0' )
  511.     Cur_rit();
  512. }
  513. void    Del_chr()
  514. {
  515.     LONG    n;
  516.  
  517.     if ( ent_ptr == btm_ptr )
  518.     return;
  519.  
  520.     if ( iskan(ent_ptr) != FALSE || 
  521.     (*Cnv_ptr(ent_ptr) == '\x0D' && *Cnv_ptr(ent_ptr+1) == '\x0A' ) )
  522.     n = 2;
  523.     else
  524.     n = 1;
  525.  
  526.     Del_buf(ent_ptr,n);
  527.     btm_ptr -= n;
  528.     Wrt_flg = Wrt_mode = TRUE;
  529. }
  530. void    Del_line()
  531. {
  532.     LONG    n,p;
  533.  
  534.     if ( (p = Nxt_line(lin_ptr)) == lin_ptr )
  535.     return;
  536.     n = p - lin_ptr;
  537.     Cut_buff(lin_ptr,p);
  538.     Del_buf(lin_ptr,n);
  539.     btm_ptr -= n;
  540.     ent_ptr = Ent_pos();
  541.     Wrt_flg = Wrt_mode = TRUE;
  542. }
  543. void    Del_rit()
  544. {
  545.     LONG    n,p;
  546.  
  547.     if ( (p = Nxt_line(lin_ptr)) == lin_ptr )
  548.     return;
  549.     if ( (n = p - ent_ptr) <= 0 )
  550.     return;
  551.     Cut_buff(ent_ptr,p);
  552.     Del_buf(ent_ptr,n);
  553.     btm_ptr -= n;
  554.     Wrt_flg = Wrt_mode = TRUE;
  555. }
  556. void    Del_left()
  557. {
  558.     LONG    n;
  559.  
  560.     if ( lin_ptr == ent_ptr )
  561.     return;
  562.     n = ent_ptr - lin_ptr;
  563.     Cut_buff(lin_ptr,ent_ptr);
  564.     Del_buf(lin_ptr,n);
  565.     btm_ptr -= n;
  566.     ent_ptr = lin_ptr;
  567.     Wrt_flg = Wrt_mode = TRUE;
  568. }
  569. void    BS_chr()
  570. {
  571.     if ( ent_ptr == 0 )
  572.     return;
  573.     Cur_left();
  574.     Del_chr();
  575. }
  576. void    Undo_set()
  577. {
  578.     LONG    n;
  579.  
  580.     if ( (n = Undo_get(ent_ptr)) > 0L ) {
  581.         btm_ptr += n;
  582.         Wrt_flg = Wrt_mode = TRUE;
  583.     }
  584. }
  585. void    Del_dmy()
  586. {
  587.     LONG    p;
  588.  
  589.     if ( (p = Nxt_line(lin_ptr)) == lin_ptr )
  590.     return;
  591.     Cut_buff(lin_ptr,p);
  592.     p = ent_ptr;
  593.     ent_ptr = lin_ptr;
  594.     Undo_set();
  595.     ent_ptr = p;
  596. }
  597. void    Ins_line()
  598. {
  599.     Ins_buf(lin_ptr,2,"\x0D\x0A");
  600.     ent_ptr = lin_ptr;
  601.     btm_ptr += 2;
  602.     Wrt_flg = Wrt_mode = TRUE;
  603. }
  604. void    Cnt_dsp()
  605. {
  606.     if ( ++CONTRL > 2 )
  607.     CONTRL = 0;
  608. }
  609. void    Dsp_ins_mode()
  610. {
  611.     if ( Ins_flg == FALSE )
  612.     wrtstr("挿入",5,0,0x17);
  613.     else
  614.     wrtstr("上書",5,0,0x17);
  615. }
  616. void    Ins_sw()
  617. {
  618.     Ins_flg = (Ins_flg == FALSE ? TRUE : FALSE );
  619.     Dsp_ins_mode();
  620. }
  621. BOOL    Read_file(file)
  622. char    *file;
  623. {
  624.     int     n;
  625.     FILE    *fp;
  626.     LONG    p;
  627.     UCHAR   tmp[256];
  628.  
  629.     if ( (fp = fopen(file,"rb")) == NULL ) {
  630.     wrtstr("(ファイルが見当たりません)",30,1,0x12);
  631.         return ERR;
  632.     }
  633.  
  634.     wrtstr("(ファイル読み込み中)",32,1,0x05);
  635.     p = ent_ptr;
  636.     while ( (n = fread(tmp,1,256,fp)) > 0 ) {
  637.         if ( tmp[n-1] == '\x1A' ) n--;
  638.     Ins_buf(p,n,tmp);
  639.         btm_ptr += n;
  640.         p += n;
  641.         Wrt_flg = Wrt_mode = TRUE;
  642.     }
  643.     fclose(fp);
  644.     wrtstr(SPCSTR,30,1,0x1F);
  645.     return FALSE;
  646. }
  647. void    Wrt_file(sp,ep)
  648. LONG    sp,ep;
  649. {
  650.     int     n;
  651.     LONG    sz;
  652.     FILE    *fp;
  653.     UCHAR   tmp[256];
  654.  
  655.     wrtstr("(ファイルに抜き出します)",32,1,0x15);
  656.     tmp[0] = '\0';
  657.     if ( Input(tmp,FILEMEI) != FALSE )
  658.     goto END;
  659.     if ( (fp = fopen((char *)tmp,"wb")) == NULL ) {
  660.         wrtstr("(ファイルが作成出来ません)",30,1,0x12);
  661.     return;
  662.     }
  663.     for ( sz = ep - sp ; sz > 0 ; ) {
  664.     if ( sz < 256 ) n = sz; else n = 256;
  665.         Cut_buf(tmp,n,sp);
  666.     fwrite(tmp,1,n,fp);
  667.     sp += n;
  668.     sz -= n;
  669.     }
  670.     tmp[0] = 0x1A;
  671.     fwrite(tmp,1,1,fp);
  672.     fclose(fp);
  673.  
  674. END:
  675.     wrtstr(SPCSTR,30,1,0x1F);
  676. }
  677. void    Dsp_free()
  678. {
  679.     static int  Line_old=(-1);
  680.     static LONG Free_buf=(-1);
  681.     int    i;
  682.     char   tmp[30];
  683.  
  684.     if ( (i = Line_no + Line_Y) != Line_old ) {
  685.         Line_old = i;
  686.         sprintf(tmp,"[%06d Line]",Line_old+1);
  687.         wrtstr(tmp,67,0,0x1F);
  688.     }
  689.     if ( btm_ptr != Free_buf ) {
  690.         Free_buf = btm_ptr;
  691.         sprintf(tmp,"[%06ld Byte]",Free_buf);
  692.         wrtstr(tmp,67,1,0x1F);
  693.     }
  694. }
  695. void    Cur_top_file()
  696. {
  697.     lin_ptr = ent_ptr = top_ptr = 0;
  698.     Line_no = 0;
  699. }
  700. void    Cur_btm_file()
  701. {
  702.     int     i;
  703.  
  704.     i = 0x7FFF;
  705.     top_ptr = lin_ptr = ent_ptr = Line_ptr(&i);
  706.     Line_no = i;
  707.     for ( i = 10 ; top_ptr > 0 && i > 0 ; i-- ) {
  708.         top_ptr = Bak_line(top_ptr);
  709.     Line_no--;
  710.     }
  711. }
  712. void    Cmds_Q()
  713. {
  714.     int     ch;
  715.     unsigned ec;
  716.  
  717.     ch = Get_key(&ec); ec &= 0xff00;
  718.     switch(ec) {
  719.     case 0x1400: Cur_top_file(); break;
  720.     case 0x2C00: Cur_btm_file(); break;
  721.     case 0x1E00: Cur_ltop(); break;
  722.     case 0x2100: Cur_lbtm(); break;
  723.     }
  724. }
  725. void    Cmds_PF1()
  726. {
  727.     int    no;
  728.     UCHAR  *p;
  729.     static int   old_no=ERR;
  730.     static UCHAR tmp[160]={ 0 };
  731.     static char *menu[]={
  732.         "1 保存して終了する  ",
  733.     "2 全て保存して終了  ",
  734.     "",
  735.         "3 ファイルを更新する    ",
  736.         "4 ファイル名を変更する  ",
  737.     "",
  738.         "5 ファイルを読み込む    ",
  739.         "6 編集を放棄する    ",
  740.     "7 全ての編集を放棄  ",
  741.     "",
  742.         "8 再編集を行う      ",
  743.         "9 新規に編集を行う  ",
  744.         NULL };
  745.  
  746.     wrtstr(SPCSTR,30,1,0x1F);
  747.     if ( Sel_menu(menu,1,2,&old_no) != FALSE )
  748.         return;
  749.  
  750.     no = old_no + 1;
  751.     if ( no == 1 || no == 2 ) {
  752.     do {
  753.         if ( Wrt_flg == FALSE ) {
  754.             wrtstr("(ファイルに変更がありません)",30,1,0x05);
  755.         } else {
  756.                 wrtstr("(書き込み中)",30,1,0x05);
  757.                 p = NULL;
  758.                 while ( save(p) != FALSE ) {
  759.                     wrtstr("(セ-ブ出来ません)",30,1,0x12);
  760.                     if ( Input(tmp,FILEMEI) != FALSE || 
  761.              File_sel(tmp) != FALSE ) {
  762.                         wrtstr(SPCSTR,30,1,0x1F);
  763.                         return;
  764.                     }
  765.                     p = tmp;
  766.                 }
  767.                 wrtstr("(書き込み終了)",30,1,0x05);
  768.         }
  769.     } while ( no == 2 && Del_wind() == FALSE );
  770.     } else if ( no == 3 ) {
  771.         if ( save(NULL) != FALSE )
  772.             wrtstr("(セ-ブ出来ません)",30,1,0x12);
  773.         return;
  774.     } else if ( no == 4 ) {
  775.         if ( Input(tmp,FILEMEI) != FALSE || File_sel(tmp) != FALSE )
  776.             return;
  777.         Set_file_name(tmp);
  778.         return;
  779.     } else if ( no == 5 ) {
  780.         if ( Input(tmp,FILEMEI) != FALSE || File_sel(tmp) != FALSE )
  781.             return;
  782.         Read_file((char *)tmp);
  783.         return;
  784.    } else if ( no == 6 || no == 7 ) {
  785.     do {
  786.             if ( Wrt_flg != FALSE &&
  787.         Yes_no("ファイルに変更があります 編集を中断しますか?") == FALSE )
  788.                     return;
  789.             wrtstr("(編集を中断しました)",30,1,0x05);
  790.     } while ( no == 7 && Del_wind() == FALSE );
  791.     } else if ( no == 8 ) {
  792.     if ( file_name == NULL ) {
  793.         wrtstr("(ファイルが設定されてません)",30,1,0x12);
  794.         return;
  795.     }
  796.     if ( Wrt_flg != FALSE &&
  797.         Yes_no("ファイルに変更があります 編集を放棄しますか?") == FALSE )
  798.                 return;
  799.     Del_buf(0l,btm_ptr);
  800.     top_ptr = lin_ptr = ent_ptr = btm_ptr = 0;
  801.     Line_no = 0;
  802.     Wrt_flg = FALSE;
  803.     Read_file(file_name);
  804.     return;
  805.     } else if ( no == 9 ) {
  806.     if ( Input(tmp,FILEMEI) != FALSE || File_sel(tmp) != FALSE )
  807.         return;
  808.     if ( Wrt_flg == FALSE && file_name == NULL ) {
  809.        Buf_init(tmp);
  810.        Set_file_name(tmp);
  811.     } else if ( New_wind(tmp) != FALSE )
  812.         wrtstr("新規編集に失敗しました",30,1,0x12);
  813.     return;
  814.     }
  815.     Endof_edit = TRUE;
  816. }
  817. LONG    Serch(ptr,str)
  818. LONG    ptr;
  819. UCHAR   *str;
  820. {
  821.     LONG    p;
  822.     UCHAR   *s;
  823.  
  824.     while ( ptr < btm_ptr ) { 
  825.     for ( p = ptr,s = str ; p < btm_ptr ; ) {
  826.         if ( *s == '\0' )
  827.         return ptr;
  828.         if ( *Cnv_ptr(p++) != *(s++) )
  829.         break;
  830.     }
  831.     ptr++;
  832.     }
  833.     return ptr;
  834. }
  835. LONG    USerch(sw,ptr,str)
  836. int    sw;
  837. LONG    ptr;
  838. UCHAR   *str;
  839. {
  840.     int     cp,cs;
  841.     LONG    p;
  842.     UCHAR   *s;
  843.  
  844.     for ( ; ; ) {
  845.     for ( p = ptr,s = str ; p < btm_ptr ; ) {
  846.         if ( *s == '\0' )
  847.         return ptr;
  848.         cp = *Cnv_ptr(p++); cp = toupper(cp);
  849.         cs = *(s++); cs = toupper(cs);
  850.         if ( cp != cs )
  851.         break;
  852.     }
  853.     if ( sw == FALSE ) {
  854.         if ( ++ptr >= btm_ptr )
  855.             return btm_ptr;
  856.     } else if ( ptr-- <= 0 )
  857.         return btm_ptr;
  858.     }
  859.     return ptr;
  860. }
  861. void    Cmds_PF2()
  862. {
  863.     int     i,j,no,ch,fg;
  864.     UCHAR   *d,tmp[160];
  865.     LONG    p,s;
  866.     static int   old_no=ERR;
  867.     static char  *menu[]={
  868.         "1 文字列の検索(大小区別無し)",
  869.         "2 文字列の置き換え(確認有り)",
  870.         "3 文字列の置き換え          ",
  871.     "",
  872.         "4 指定行番号に移動          ",
  873.         "5 ファイルの先頭に移動      ",
  874.         "6 ファイルの最後に移動      ",
  875.         NULL };
  876.  
  877.     wrtstr(SPCSTR,30,1,0x1F);
  878.     if ( Sel_menu(menu,10,2,&old_no) != FALSE )
  879.         return;
  880.     no = old_no + 1;
  881.  
  882.     if ( no == 1 ) {
  883.         if ( Input(sctmp,"検索文字列 ") != FALSE || sctmp[0] == '\0' )
  884.         return;
  885.     for ( fg = FALSE ; ; ) {
  886.         if ( (p = USerch(fg,ent_ptr,sctmp)) >= btm_ptr ) {
  887.         wrtstr("(見つかりません)",30,1,0x15);
  888.         return;
  889.         }
  890.         chk_ptr = ent_ptr = p; p += strlen(sctmp); cke_ptr = p;
  891.         lin_ptr = Top_line(ent_ptr);
  892.         for ( s = lin_ptr,i = 10 ; i > 0 ; i-- )
  893.         s = Bak_line(s);
  894.         while ( top_ptr < s ) {
  895.         top_ptr = Nxt_line(top_ptr);
  896.         Line_no++;
  897.         }
  898.         while ( top_ptr > s ) {
  899.         top_ptr = Bak_line(top_ptr);
  900.         Line_no--;
  901.         }
  902.         Set_vram();
  903.         Dsp_vram(vram);
  904.         Dsp_free();
  905.         chk_ptr = cke_ptr = ERR;
  906.         ch = getch();
  907.         if ( ch == '\x1B' )
  908.         return;
  909.         else if ( ch == '\x0D' || ch == ' ' || ch == '\x1F' )
  910.         fg = FALSE;
  911.         else if ( ch == '\x08' || ch == '\x1E' )
  912.         fg = TRUE;
  913.  
  914.         if ( fg == FALSE )
  915.             ent_ptr = p;
  916.         else if ( ent_ptr > 0 )
  917.         ent_ptr--;
  918.     }
  919.     } else if ( no == 2 || no == 3 ) {
  920.         if ( Input(rpsctmp,"現文字列 ") != FALSE )
  921.         return;
  922.         if ( Input(rpdstmp,"新文字列 ") != FALSE )
  923.         return;
  924.     if ( rpsctmp[0] == '\0' || rpdstmp[0] == '\0' )
  925.         return;
  926.     while ( ent_ptr < btm_ptr ) {
  927.         if ( (p = Serch(ent_ptr,rpsctmp)) >= btm_ptr ) {
  928.         wrtstr("(見つかりません)",30,1,0x15);
  929.         return;
  930.         }
  931.         chk_ptr = ent_ptr = p; p += strlen(rpsctmp); cke_ptr = p;
  932.         lin_ptr = Top_line(ent_ptr);
  933.         for ( s = lin_ptr,i = 10 ; i > 0 ; i-- )
  934.         s = Bak_line(s);
  935.         while ( top_ptr < s ) {
  936.         top_ptr = Nxt_line(top_ptr);
  937.         Line_no++;
  938.         }
  939.         Set_vram();
  940.         Dsp_vram(vram);
  941.         Dsp_free();
  942.         chk_ptr = cke_ptr = ERR;
  943.         if ( no == 2 ) {
  944.         i = getch();
  945.         if ( i == '\x1B' )
  946.             return;
  947.         else if ( i == ' ' ) {
  948.             ent_ptr = p;
  949.             continue;
  950.         }
  951.         }
  952.         if ( (i = strlen(rpsctmp)) > (j = strlen(rpdstmp)) ) {
  953.         Del_buf(ent_ptr+j,(LONG)(i - j));
  954.             btm_ptr -= (i - j);
  955.         } else if ( i < j ) {
  956.         Ins_buf(ent_ptr+i,(LONG)(j - i),rpdstmp);
  957.             btm_ptr += (j - i);
  958.         }
  959.             for ( d = rpdstmp ; j-- > 0 ; )
  960.         *Cnv_ptr(ent_ptr++) = *(d++);
  961.         Wrt_flg = Wrt_mode = TRUE;
  962.     }
  963.     } else if ( no == 4 ) {
  964.     tmp[0] = '\0';
  965.     if ( Input(tmp,"行番号 ") == FALSE ) {
  966.         i = atoi((char *)tmp) - 1;
  967.         top_ptr = Line_ptr(&i); Line_no = i;
  968.         lin_ptr = ent_ptr = top_ptr;
  969.         for ( i = 10 ; i > 0 && top_ptr > 0 ; i-- ) {
  970.         top_ptr = Bak_line(top_ptr);
  971.         Line_no--;
  972.         }
  973.     }
  974.     } else if ( no == 5 ) {
  975.     Cur_top_file();
  976.     } else if ( no == 6 ) {
  977.     Cur_btm_file();
  978.     } else if ( no == 7 ) {
  979. #ifdef    FMR70
  980.     cprintf("\x1B[24;1H");
  981.     system("COMMAND.COM");
  982.     Dsp_status();
  983.     Dsp_free();
  984. #endif
  985. #ifdef    TOWNS
  986.         wrtstr("(実現不能?)",32,1,0x05);
  987. #endif
  988.     }
  989. }
  990. void    Cmds_PF3()
  991. {
  992.     static int  no=ERR,clic=0;
  993.     int     i;
  994.     UCHAR   tmp[80];
  995.     char    *menu[8];
  996.     char    ttl[5][60];
  997.  
  998.     sprintf(ttl[0],"1 TABコ-ド長の設定(現在%d個) ",TAB);
  999.     sprintf(ttl[1],"2 TABコ-ドの展開を%s%s",
  1000.         TAB_mode != 0 ? "行わない":"行う",
  1001.         "            ");
  1002.     sprintf(ttl[2],"3 %sコ-ドの表示を%s%s",
  1003.         CONTRL == 0 ? "CR" : "CR&TAB",
  1004.         CONTRL != 2 ? "行う" : "行わない",
  1005.         "            ");
  1006.     sprintf(ttl[3],"4 キ-ボ-ド クリック音を%s%s",
  1007.         clic == 0 ? "鳴らす" : "消す",
  1008.         "             ");
  1009.     sprintf(ttl[4],"5 行番号表示を%s%s",
  1010.         dlp_flg == FALSE ? "する" : "しない",
  1011.         "             ");
  1012.  
  1013.     i = strlen(ttl[0]); 
  1014.     ttl[1][i] = ttl[2][i] = ttl[3][i] = ttl[4][i] = '\0';
  1015.     menu[0] = ttl[0]; menu[1] = ttl[1]; menu[2] = "";
  1016.     menu[3] = ttl[2]; menu[4] = ttl[3]; 
  1017.     menu[5] = "";     menu[6] = ttl[4]; menu[7] = NULL;
  1018.     if ( Sel_menu(menu,20,2,&no) != FALSE )
  1019.     return;
  1020.  
  1021.     if ( no == 0 ) {
  1022.     tmp[0] = '\0';
  1023.     if ( Input(tmp,"TAB長(1-40) ") != FALSE )
  1024.         return;
  1025.     if ( (i = atoi((char *)tmp)) < 1 || i > 40 )
  1026.         return;
  1027.     TAB = i;
  1028.     } else if ( no == 1 ) {
  1029.     TAB_mode = (TAB_mode == 0 ? 1 : 0);
  1030.     } else if ( no == 2 ) {
  1031.     if ( ++CONTRL > 2 )
  1032.         CONTRL = 0;
  1033.     } else if ( no == 3 ) {
  1034.     KYB_clic(clic);
  1035.     clic = (clic == 0 ? 1 : 0);
  1036.     } else if ( no == 4 ) {
  1037.     dlp_flg = (dlp_flg == FALSE ? TRUE : FALSE);
  1038.     if ( dlp_flg != FALSE && Wind_flg == FALSE ) {
  1039.         Wind_flg = TRUE;
  1040.     }
  1041.     }
  1042. }
  1043. void    Cmds_PF4()
  1044. {
  1045.     static int   no=ERR;
  1046.     static char  *menu[]={
  1047.         "1 ウインドサイズの変更 ",
  1048.         "2 文字表示色の変更     ",
  1049.     "",
  1050.     "3 ASCIIコ-ドの挿入    ",
  1051.     "4 漢字コ-ドの挿入     ",
  1052.     "",
  1053.     "5 編集バッファの印刷   ",
  1054.         NULL };
  1055.  
  1056.     wrtstr(SPCSTR,30,1,0x1F);
  1057.     if ( Sel_menu(menu,25,2,&no) != FALSE )
  1058.         return;
  1059.  
  1060.     if ( no == 0 )
  1061.     ReSize_wind();
  1062.     else if ( no == 1 )
  1063.     ChgCol_wind();
  1064.     else if ( no == 2 )
  1065.     ASCII_code();
  1066.     else if ( no == 3 )
  1067.     KANJI_code();
  1068.     else if ( no == 4 )
  1069.     Printer_out();
  1070. }
  1071. void    Cmds_PF6()
  1072. {
  1073.     int      ch,n,i,j,fg,no;
  1074.     unsigned ec;
  1075.     LONG     p,s,old_top;
  1076.     UCHAR    *d;
  1077.  
  1078.     chk_ptr = cke_ptr = ent_ptr; fg = FALSE;
  1079.     old_top = top_ptr; no = Line_no;
  1080.     wrtstr("範囲指定中",30,0,0x15);
  1081.     wrtstr(SPCSTR,30,1,0x1F);
  1082.     for ( ; ; ) {
  1083.         while ( kbhit() == FALSE );
  1084.  
  1085.         while ( kbhit() != FALSE ) {
  1086.         ch = Get_key(&ec);
  1087.         if ( ec == 0x0100 ) {
  1088.         goto ENDOF;
  1089.         } else if ( ec == 0x6200 || ec == 0x2410 ) {
  1090.         chk_ptr = cke_ptr = ent_ptr; no = Line_no;
  1091.         } else if ( ec == 0x6300 || ec == 0x1610 ) {
  1092.         if ( (n = cke_ptr - chk_ptr) > 0 ) {
  1093.                     if ( Cut_buff(chk_ptr,cke_ptr) != FALSE ) {
  1094.             if ( Yes_no("アンドゥ出来ません  削除を行いますか?") == FALSE )
  1095.                             goto ENDOF;
  1096.                     }
  1097.             Del_buf(chk_ptr,(LONG)(cke_ptr - chk_ptr));
  1098.                 btm_ptr -= n;
  1099.                 ent_ptr = chk_ptr;
  1100.             lin_ptr = Top_line(ent_ptr);
  1101.             if ( lin_ptr <= top_ptr ) {
  1102.             top_ptr = old_top;
  1103.             Line_no = no;
  1104.             }
  1105.             Wrt_flg = Wrt_mode = TRUE;
  1106.         }
  1107.         goto ENDOF;
  1108.         } else if ( ec == 0x6400 || ec == 0x2510 ) {
  1109.         if ( (cke_ptr - chk_ptr) > 0 )
  1110.             Cut_buff(chk_ptr,cke_ptr);
  1111.         goto ENDOF;
  1112.         } else if ( ec == 0x6500 ) {
  1113.         if ( (cke_ptr - chk_ptr) > 0 )
  1114.             Wrt_file(chk_ptr,cke_ptr);
  1115.         goto ENDOF;
  1116.         } else if ( ec == 0x5E00 ) {
  1117.         wrtstr("指定範囲内の文字列置き換え",30,1,0x15);
  1118.             if ( Input(rpsctmp,"現文字列 ") != FALSE )
  1119.                 goto ENDOF;
  1120.                 if ( Input(rpdstmp,"新文字列 ") != FALSE )
  1121.             goto ENDOF;
  1122.         ent_ptr = chk_ptr;
  1123.         lin_ptr = Top_line(ent_ptr);
  1124.         if ( lin_ptr <= top_ptr ) {
  1125.             top_ptr = old_top;
  1126.             Line_no = no;
  1127.         }
  1128.         old_top = cke_ptr;
  1129.         while ( ent_ptr < old_top ) {
  1130.             if ( (p = Serch(ent_ptr,rpsctmp)) >= old_top )
  1131.             goto ENDOF;
  1132.             chk_ptr = ent_ptr = p; p += strlen(rpsctmp); cke_ptr = p;
  1133.                 lin_ptr = Top_line(ent_ptr);
  1134.                 for ( s = lin_ptr,i = 10 ; i > 0 ; i-- )
  1135.             s = Bak_line(s);
  1136.             while ( top_ptr < s ) {
  1137.                 top_ptr = Nxt_line(top_ptr);
  1138.                 Line_no++;
  1139.                 }
  1140.                 Set_vram();
  1141.                 Dsp_vram(vram);
  1142.                 Dsp_free();
  1143.                 chk_ptr = cke_ptr = ERR;
  1144.             i = getch();
  1145.             if ( i == '\x1B' )
  1146.                 goto ENDOF;
  1147.             else if ( i == ' ' ) {
  1148.                 ent_ptr = p;
  1149.                 continue;
  1150.             }
  1151.                 if ( (i = strlen(rpsctmp)) > (j = strlen(rpdstmp)) ) {
  1152.                 Del_buf(ent_ptr+j,(LONG)(i - j));
  1153.                     btm_ptr -= (i - j);
  1154.                 } else if ( i < j ) {
  1155.                 Ins_buf(ent_ptr+i,(LONG)(j - i),rpdstmp);
  1156.                     btm_ptr += (j - i);
  1157.                 }
  1158.                     for ( d = rpdstmp ; j-- > 0 ; )
  1159.                 *Cnv_ptr(ent_ptr++) = *(d++);
  1160.         }
  1161.         goto ENDOF;
  1162.         }
  1163.         for ( i = 0 ; i < MOVECMDS && key_tbl[i].key_code != 0 ; i++ ) {
  1164.             if ( key_tbl[i].key_code == ec ) {
  1165.             (*(key_tbl[i].key_proc))();
  1166.             break;
  1167.         }
  1168.         }
  1169.         if ( fg == FALSE ) {
  1170.         if ( ent_ptr < chk_ptr ) {
  1171.             fg = TRUE;
  1172.             chk_ptr = ent_ptr;
  1173.             old_top = top_ptr;
  1174.             no = Line_no;
  1175.         } else
  1176.             cke_ptr = ent_ptr;
  1177.         } else {
  1178.         if ( ent_ptr > cke_ptr ) {
  1179.             fg = FALSE;
  1180.             cke_ptr = ent_ptr;
  1181.         } else {
  1182.             chk_ptr = ent_ptr;
  1183.             old_top = top_ptr;
  1184.             no = Line_no;
  1185.         }
  1186.         }
  1187.     }
  1188.         Set_vram();
  1189.         Dsp_vram(vram);
  1190.     Dsp_free();
  1191.     }
  1192. ENDOF:
  1193.     wrtstr(SPCSTR,30,0,0x1F);
  1194.     wrtstr(SPCSTR,30,1,0x1F);
  1195.     chk_ptr = cke_ptr = ERR;
  1196. }
  1197. BOOL    edit()
  1198. {
  1199.     int        i,n,ch,p;
  1200.     unsigned ec;
  1201.     UCHAR   tmp[40];    
  1202.  
  1203.     while ( kbhit() == 0 );
  1204.  
  1205.     Endof_edit = Wrt_mode = FALSE;
  1206.     for ( p = n = 0 ; Endof_edit == FALSE &&
  1207.               kbhit() != 0 && n < 10 ; n++ ) {
  1208.     ch = Get_key(&ec);
  1209.     for ( i = 0 ; key_tbl[i].key_code != 0 ; i++ ) {
  1210.         if ( key_tbl[i].key_code == ec ) {
  1211.         if ( p > 0 ) {
  1212.             set_chr(tmp,p);
  1213.             p = n = 0;
  1214.         }
  1215.         (*(key_tbl[i].key_proc))();
  1216.         break;
  1217.         }
  1218.     }
  1219.     if ( ch != 0xFFFF && key_tbl[i].key_code == 0 ) {
  1220.         tmp[p++] = ch;
  1221.         if ( p >= 30 ) {
  1222.         set_chr(tmp,p);
  1223.             p = 0;
  1224.         }
  1225.         n = 0;
  1226.     }
  1227.         Dsp_free();
  1228.     }
  1229.     if ( p > 0 )
  1230.     set_chr(tmp,p);
  1231.     Set_vram();
  1232.     Dsp_vram(vram);
  1233.     Dsp_wrt_flg();
  1234.     Dsp_free();
  1235.     if ( Endof_edit != FALSE )
  1236.     return TRUE;
  1237.     else
  1238.         return FALSE;
  1239. }
  1240.